package mil.af.amc.adpetracker.web.actions.struts2.adpeAccount;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Preparable;
import mil.af.amc.adpetracker.model.AdpeAccount;
import mil.af.amc.adpetracker.service.AdpeAccountService;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * Struts2 action implementation for adpeAccount actions
 *
 * @author Jason Ferguson
 */
@Namespace("adpeAccount")
public class AdpeAccountAction extends ActionSupport implements ModelDriven<AdpeAccount>, Preparable {

    @Autowired
    private AdpeAccountService adpeAccountService;

    // ModelDriven implementation

    private AdpeAccount model;

    public AdpeAccount getModel() {
        return model;
    }

    // Preparable implementation
    public void prepare() throws Exception {

    }

    public void prepareExecute() throws Exception {

        accountList = adpeAccountService.getAll();

    }

    private List<AdpeAccount> accountList;

    /**
     * Return a view of all of the ADPE accounts
     *
     * @return
     * @throws Exception
     */
    @Action(value = "list", results = {
            @Result(name = "success", location = "/WEB-INF/struts2/adpeAccount/list.jsp")
    })
    public String execute() throws Exception {

        return SUCCESS;
    }

    /**
     * Return a view of the profile of an individual account
     *
     * @return
     * @throws Exception
     */
    @Action(value = "viewProfile", results = {
            @Result(name="success", location = "/WEB-INF/struts2/adpeAccount/viewProfile.jsp")
    })
    public String viewProfile() throws Exception {
        throw new UnsupportedOperationException();
    }

    /**
     * Return a view of the creation page for ADPE Accounts
     *
     * @return
     * @throws Exception
     */
    @Action(value = "viewCreate", results = {
            @Result(name="success", location = "/WEB-INF/struts2/adpeAccount/viewCreate.jsp")
    })
    public String viewCreate() throws Exception {
        throw new UnsupportedOperationException();
    }

    /**
     * Create the ADPE Account
     *
     * @return
     * @throws Exception
     */
    @Action(value = "create", results = {
            @Result(name="success", location = "/WEB-INF/struts2/adpeAccount/list.jsp"),
            @Result(name="input", location = "/WEB-INF/struts2/adpeAccount/viewCreate.jsp")
    })
    public String create() throws Exception {
        throw new UnsupportedOperationException();
    }


    /**
     * Delete an ADPE Account
     *
     * @return
     * @throws Exception
     */
    @Action(value = "delete", results = {
            @Result(name = "success", location = "/WEB-INF/struts2/adpeAccount/list.jsp"),
            @Result(name = "input", location = "/WEB-INF/struts2/adpeAccount/list.jsp")
    })
    public String delete() throws Exception {
        throw new UnsupportedOperationException();
    }

    /**
     * Return the view to assign the Primary Account Custodian
     *
     * @return
     * @throws Exception
     */
    public String viewAssignPrimaryCustodian() throws Exception {
        throw new UnsupportedOperationException();
    }

    /**
     * Assign the primary account custodian
     *
     * @return
     * @throws Exception
     */
    public String assignPrimaryCustodian() throws Exception {
        throw new UnsupportedOperationException();
    }

    /**
     * Return the view to assign an alternate account custodian
     *
     * @return
     * @throws Exception
     */
    public String viewAssignAlternateCustodian() throws Exception {
        throw new UnsupportedOperationException();
    }

    /**
     * Assign the alternate account custodian
     *
     * @return
     * @throws Exception
     */
    public String assignAlternateCustodian() throws Exception {
        throw new UnsupportedOperationException();
    }

    /**
     * Remove an alternate account custodian
     *
     * @return
     * @throws Exception
     */
    public String removeAlternateCustodian() throws Exception {
        throw new UnsupportedOperationException();
    }
}
